/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package test;

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;

/**
 *
 * @author kevin
 */
public class MyJList extends JFrame {

    public MyJList(){
        initialize();
    }

    private void initialize() {
          JList list = new JList();
        DefaultListModel m = new DefaultListModel();
        
        m.addElement("a");
        m.addElement("b");
        m.addElement("c");
        list.setModel(m);
        //list.setVisible(true);
        add(list,BorderLayout.CENTER);
        JLabel label =new JLabel("asdfasdfasdflsakj");
        this.add(label,BorderLayout.EAST);
    }
    public static void main(String[] args){
        final MyJList f = new MyJList();
        f.setSize(400, 400);
        f.setVisible(true);
        f.addWindowListener(new WindowAdapter(){
            @Override
            public void windowClosing(WindowEvent e){
                f.dispose();
                System.exit(0);
            }
        });
    }

}
